package com.sdl.test.flutter_sdl_test

import android.os.Bundle
import android.util.Log
import com.sdl.test.flutter_sdl_test.jni.JNIProxy
import com.sdl.test.flutter_sdl_test.surface_view.MySurfaceViewFactory
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine

class MainActivity: FlutterActivity(){

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        JNIProxy.CalPixel()
    }

    override fun onStop() {
        super.onStop()
        JNIProxy.StopRenderS()
    }

    override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
        super.configureFlutterEngine(flutterEngine)
        Log.d("ssss", "2222222")
        // 注册为Flutter插件
//        flutterEngine.plugins.add(MySurfaceViewPlugin(this))

        flutterEngine
                .platformViewsController
                .registry
                .registerViewFactory(
                        "com.sdl.test.flutter_sdl_test.surface_view/MySurfaceView",  // 注册的view类型，flutter将会用这个来查找对应的view
                        MySurfaceViewFactory(this) // 你的ViewFactory
                )
    }
}
